package blackhouse.advanced.pipedstreamTest;

import java.io.IOException;
import java.io.PipedInputStream;

public class Receiver extends Thread
{
	 private PipedInputStream in = new PipedInputStream();

		public PipedInputStream getInputStream()
		{
			return in;
		}
		public void run(){
			byte[] buf = new byte[1024];
			try
			{
				int len=in.read(buf);
				System.out.println("the following message comes from sender:\n"+new String(buf,0,len));
				in.close();
			} catch (IOException e)
			{
				e.printStackTrace();
			}
		
		}
}
